using UnityEngine;
using QFramework;

namespace ProjectSurvivor
{
	public partial class HP : GameplayObject//表示一个挂在场景物体上的控制器（如玩家、刷怪器）。
	{
		void OnTriggerEnter2D(Collider2D other)
		{
			if (other.GetComponent<CollectableArea>())
			{
				if (Global.HP.Value == Global.MaxHP.Value)
				{

				}
				else
				{
					AudioKit.PlaySound("hp");
					Global.HP.Value++;
					this.DestroyGameObjGracefully();//取消注册 “当 GameObject（游戏对象）销毁时”
				}

			}

		}
		public override Collider2D collision2D => SelfCircleCollider2D;
	}
}
